package istar.impl;

import istar.IElement;
import istar.IElementLink;

import java.io.Serializable;
import java.util.List;
import java.util.Vector;

public abstract class AbstractElementLink implements IElementLink, Serializable{
	private String name, id;
	private IElement owner;
	private int type;
	private List<IElement> subElements = new Vector<IElement>();
	
	public AbstractElementLink(String name,  IElement _owner, IElement _subElement){
		super();
		this.name = name;
		this.owner = _owner;
		_subElement.setMain(false);
		this.subElements.add(_subElement);
	}
	
	public AbstractElementLink(String id, String name,  IElement _owner, IElement _subElement){
		super();
		this.id = id;
		this.name = name;
		this.owner = _owner;
		_subElement.setMain(false);
		this.subElements.add(_subElement);
	}
	
	
	public AbstractElementLink(String name){
		super();
		this.name = name;
	}
	
	public AbstractElementLink(String id, String name){
		super();
		this.id = id;
		this.name = name;
	
	}
	
	public AbstractElementLink(){
		super();
	}
	
	@Override
	public String getName() {
		return name;
	}

	@Override
	public void setName(String value) {
		this.name = value;
	}

	
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public IElement getOwner() {
		return owner;
	}

	@Override
	public void setOwner(IElement elmnt) throws Exception {
		owner = elmnt;
	}

	public List<IElement> getTargetElements() {
		return subElements; 
	}


	public void setTargetElements(List<IElement> subElements) {
		this.subElements = subElements;
	}


	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	
	
	/*
	@Override
	public IElement getTargetElement() {
		return subElement;
	}

	@Override
	public void setTargetElement(IElement target) throws Exception {
		subElement = target;		
	}
	*/
}
